using System;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
using Oracle.ManagedDataAccess.Client;
using OracleInternal.Common;

namespace Oracle.ManagedDataAccess.Types
{
	[Serializable]
	[XmlSchemaProvider("GetXsdType")]
	public struct OracleTimeStamp : IComparable, INullable, IXmlSerializable
	{
		private bool m_bNotNull;

		private int m_fSecondPrec;

		internal byte[] m_byteRepresentation;

		private int m_year;

		private int m_month;

		private int m_day;

		private int m_hour;

		private int m_minute;

		private int m_second;

		private int m_nanosecond;

		internal const byte MaxArrSize = 11;

		public static readonly OracleTimeStamp MaxValue = new OracleTimeStamp(9999, 12, 31, 23, 59, 59, 999999999);

		public static readonly OracleTimeStamp MinValue = new OracleTimeStamp(-4712, 1, 1, 0, 0, 0, 0);

		public static readonly OracleTimeStamp Null;

		public byte[] BinData
		{
			get
			{
				if (m_bNotNull)
				{
					byte[] array = null;
					if (m_byteRepresentation != null)
					{
						array = new byte[11];
						Array.Copy(m_byteRepresentation, array, m_byteRepresentation.Length);
					}
					return array;
				}
				throw new OracleNullValueException();
			}
		}

		public bool IsNull => !m_bNotNull;

		public DateTime Value
		{
			get
			{
				if (m_bNotNull)
				{
					return DateTimeConv.GetDateTime(m_byteRepresentation, OracleDbType.TimeStamp);
				}
				throw new OracleNullValueException();
			}
		}

		public int Year
		{
			get
			{
				if (m_bNotNull)
				{
					return m_year;
				}
				throw new OracleNullValueException();
			}
		}

		public int Month
		{
			get
			{
				if (m_bNotNull)
				{
					return m_month;
				}
				throw new OracleNullValueException();
			}
		}

		public int Day
		{
			get
			{
				if (m_bNotNull)
				{
					return m_day;
				}
				throw new OracleNullValueException();
			}
		}

		public int Hour
		{
			get
			{
				if (m_bNotNull)
				{
					return m_hour;
				}
				throw new OracleNullValueException();
			}
		}

		public int Minute
		{
			get
			{
				if (m_bNotNull)
				{
					return m_minute;
				}
				throw new OracleNullValueException();
			}
		}

		public int Second
		{
			get
			{
				if (m_bNotNull)
				{
					return m_second;
				}
				throw new OracleNullValueException();
			}
		}

		public double Millisecond
		{
			get
			{
				if (m_bNotNull)
				{
					return (double)TimeStamp.GetTSData(m_byteRepresentation, 7) / 1000000.0;
				}
				throw new OracleNullValueException();
			}
		}

		public int Nanosecond
		{
			get
			{
				if (m_bNotNull)
				{
					return m_nanosecond;
				}
				throw new OracleNullValueException();
			}
		}

		internal byte[] InternalByteRepresentation => m_byteRepresentation;

		public OracleTimeStamp(int year, int month, int day, int hour, int minute, int second, int nanosecond)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor);
			}
			try
			{
				if (!TimeStamp.IsValidDateTime(year, month, day, hour, minute, second, nanosecond))
				{
					throw new ArgumentOutOfRangeException();
				}
				m_byteRepresentation = TimeStamp.ConstructByteArrayTS(year, month, day, hour, minute, second, nanosecond);
				m_year = year;
				m_month = month;
				m_day = day;
				m_hour = hour;
				m_minute = minute;
				m_second = second;
				m_nanosecond = nanosecond;
				m_bNotNull = true;
				m_fSecondPrec = 9;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor);
				}
			}
		}

		public OracleTimeStamp(int year, int month, int day, int hour, int minute, int second, double millisecond)
			: this(year, month, day, hour, minute, second, (int)(millisecond * 1000000.0))
		{
		}

		public OracleTimeStamp(int year, int month, int day)
			: this(year, month, day, 0, 0, 0, 0)
		{
		}

		public OracleTimeStamp(int year, int month, int day, int hour, int minute, int second)
			: this(year, month, day, hour, minute, second, 0)
		{
		}

		public OracleTimeStamp(DateTime date)
			: this(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, TimeStamp.GetFsecond(date))
		{
		}

		public OracleTimeStamp(byte[] binData)
			: this(binData, bCopyData: true)
		{
		}

		public OracleTimeStamp(string tsStr)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor);
			}
			try
			{
				m_year = (m_month = (m_day = (m_hour = (m_minute = (m_second = (m_nanosecond = (m_fSecondPrec = 0)))))));
				m_bNotNull = false;
				m_byteRepresentation = null;
				FromString(tsStr);
				m_bNotNull = true;
				m_fSecondPrec = 9;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor);
				}
			}
		}

		internal OracleTimeStamp(byte[] binData, int fSecondPrec)
			: this(binData)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor);
			}
			try
			{
				int nanosecond = m_nanosecond;
				m_bNotNull = true;
				m_fSecondPrec = fSecondPrec;
				nanosecond = Convert.ToInt32(Math.Round((double)nanosecond / 1000000000.0, fSecondPrec) * 1000000000.0);
				if (nanosecond < 1000000000)
				{
					m_byteRepresentation[7] = (byte)(nanosecond >> 24);
					m_byteRepresentation[8] = (byte)((uint)(nanosecond >> 16) & 0xFFu);
					m_byteRepresentation[9] = (byte)((uint)(nanosecond >> 8) & 0xFFu);
					m_byteRepresentation[10] = (byte)((uint)nanosecond & 0xFFu);
					m_nanosecond = nanosecond;
					return;
				}
				int num = m_year;
				int num2 = m_month;
				int num3 = m_day;
				int num4 = m_hour;
				int num5 = m_minute;
				int num6 = m_second;
				int num7 = 1;
				if (num < 0)
				{
					num7 = -1;
				}
				if (nanosecond > 999999999)
				{
					nanosecond = 0;
					num6++;
				}
				if (num6 > 59)
				{
					num6 = 0;
					num5++;
				}
				if (num5 > 59)
				{
					num5 = 0;
					num4++;
				}
				if (num4 > 23)
				{
					num4 = 0;
					num3++;
				}
				if (num3 > DateTime.DaysInMonth((num == 0) ? 4 : (num * num7), num2))
				{
					num3 = 1;
					num2++;
				}
				if (num2 > 12)
				{
					num2 = 1;
					num++;
				}
				if (num > 9999 || num < -4712)
				{
					throw new OverflowException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.YEAR_OUT_OF_RANGE));
				}
				m_year = num;
				m_month = num2;
				m_day = num3;
				m_hour = num4;
				m_minute = num5;
				m_second = num6;
				m_nanosecond = nanosecond;
				m_byteRepresentation = TimeStamp.ConstructByteArrayTS(num, num2, num3, num4, num5, num6, nanosecond);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor);
				}
			}
		}

		internal OracleTimeStamp(byte[] binData, bool bCopyData)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor);
			}
			try
			{
				if (binData == null)
				{
					throw new ArgumentNullException();
				}
				if (binData.Length != 11)
				{
					throw new ArgumentException();
				}
				m_bNotNull = true;
				m_fSecondPrec = 9;
				if (bCopyData)
				{
					int num = binData.Length;
					m_byteRepresentation = new byte[num];
					Array.Copy(binData, m_byteRepresentation, num);
				}
				else
				{
					m_byteRepresentation = binData;
				}
				TimeStamp.ExtractTimeStampValuesFromByteArray(m_byteRepresentation, out m_year, out m_month, out m_day, out m_hour, out m_minute, out m_second, out m_nanosecond, out var _, out var _, out var _, TSType.TimeStamp);
				if (!TimeStamp.IsValidDateTime(m_year, m_month, m_day, m_hour, m_minute, m_second, m_nanosecond))
				{
					throw new OverflowException();
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor);
				}
			}
		}

		internal OracleTimeStamp(byte[] binData, int dataOffset, int dataLength, bool bCopyData)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor);
			}
			try
			{
				if (dataLength == 0)
				{
					dataLength = binData.Length;
				}
				if (binData == null)
				{
					throw new ArgumentNullException();
				}
				m_bNotNull = true;
				m_fSecondPrec = 9;
				if (bCopyData)
				{
					m_byteRepresentation = new byte[11];
					Array.Copy(binData, dataOffset, m_byteRepresentation, 0, dataLength);
				}
				else
				{
					m_byteRepresentation = binData;
				}
				TimeStamp.ExtractTimeStampValuesFromByteArray(m_byteRepresentation, out m_year, out m_month, out m_day, out m_hour, out m_minute, out m_second, out m_nanosecond, out var _, out var _, out var _, TSType.TimeStamp);
				if (!TimeStamp.IsValidDateTime(m_year, m_month, m_day, m_hour, m_minute, m_second, m_nanosecond))
				{
					throw new OverflowException();
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor);
				}
			}
		}

		public static XmlQualifiedName GetXsdType(XmlSchemaSet schemaSet)
		{
			return new XmlQualifiedName("dateTime", "http://www.w3.org/2001/XMLSchema");
		}

		XmlSchema IXmlSerializable.GetSchema()
		{
			return null;
		}

		void IXmlSerializable.ReadXml(XmlReader reader)
		{
			string attribute = reader.GetAttribute("null", "http://www.w3.org/2001/XMLSchema-instance");
			if (attribute == null || !XmlConvert.ToBoolean(attribute))
			{
				FromString(reader.ReadElementString());
				m_bNotNull = true;
			}
			else
			{
				m_bNotNull = false;
			}
		}

		void IXmlSerializable.WriteXml(XmlWriter writer)
		{
			if (m_bNotNull)
			{
				writer.WriteString(ToString());
			}
			else
			{
				writer.WriteAttributeString("xsi", "null", "http://www.w3.org/2001/XMLSchema-instance", "true");
			}
		}

		public OracleTimeStamp AddYears(int years)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddYears);
			}
			try
			{
				if (years < -999999999 || years > 999999999)
				{
					throw new ArgumentOutOfRangeException("years");
				}
				if (m_bNotNull)
				{
					return AddYearMonthToTimeStamp(m_byteRepresentation, years, 0L);
				}
				throw new OracleNullValueException();
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddYears, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddYears);
				}
			}
		}

		public OracleTimeStamp AddMonths(long months)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddMonths);
			}
			try
			{
				if (months <= -12000000000L || months >= 12000000000L)
				{
					throw new ArgumentOutOfRangeException("months");
				}
				if (m_bNotNull)
				{
					return AddYearMonthToTimeStamp(m_byteRepresentation, 0, months);
				}
				throw new OracleNullValueException();
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddMonths, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddMonths);
				}
			}
		}

		public OracleTimeStamp AddDays(double days)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddDays);
			}
			try
			{
				if (days <= -1000000000.0 || days >= 1000000000.0)
				{
					throw new ArgumentOutOfRangeException("days");
				}
				if (m_bNotNull)
				{
					return AddDayTimeToTimeStamp(m_byteRepresentation, days, 2);
				}
				throw new OracleNullValueException();
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddDays, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddDays);
				}
			}
		}

		public OracleTimeStamp AddHours(double hours)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddHours);
			}
			try
			{
				if (hours <= -24000000000.0 || hours >= 24000000000.0)
				{
					throw new ArgumentOutOfRangeException("hours");
				}
				if (m_bNotNull)
				{
					return AddDayTimeToTimeStamp(m_byteRepresentation, hours, 3);
				}
				throw new OracleNullValueException();
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddHours, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddHours);
				}
			}
		}

		public OracleTimeStamp AddMinutes(double minutes)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddMinutes);
			}
			try
			{
				if (minutes <= -1440000000000.0 || minutes >= 1440000000000.0)
				{
					throw new ArgumentOutOfRangeException("minutes");
				}
				if (m_bNotNull)
				{
					return AddDayTimeToTimeStamp(m_byteRepresentation, minutes, 4);
				}
				throw new OracleNullValueException();
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddMinutes, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddMinutes);
				}
			}
		}

		public OracleTimeStamp AddSeconds(double seconds)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddSeconds);
			}
			try
			{
				if (seconds <= -86400000000000.0 || seconds >= 86400000000000.0)
				{
					throw new ArgumentOutOfRangeException("seconds");
				}
				if (m_bNotNull)
				{
					return AddDayTimeToTimeStamp(m_byteRepresentation, seconds, 5);
				}
				throw new OracleNullValueException();
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddSeconds, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddSeconds);
				}
			}
		}

		public OracleTimeStamp AddMilliseconds(double milliseconds)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddMilliseconds);
			}
			try
			{
				if (milliseconds <= -8.64E+16 || milliseconds >= 8.64E+16)
				{
					throw new ArgumentOutOfRangeException("milliseconds");
				}
				if (m_bNotNull)
				{
					long num = (long)(milliseconds * 1000000.0);
					return AddDayTimeToTimeStamp(m_byteRepresentation, num, 7);
				}
				throw new OracleNullValueException();
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddMilliseconds, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddMilliseconds);
				}
			}
		}

		public OracleTimeStamp AddNanoseconds(long nanoseconds)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddNanoseconds);
			}
			try
			{
				if (m_bNotNull)
				{
					return AddDayTimeToTimeStamp(m_byteRepresentation, nanoseconds, 7);
				}
				throw new OracleNullValueException();
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddNanoseconds, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddNanoseconds);
				}
			}
		}

		public override string ToString()
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ToString);
			}
			try
			{
				if (m_bNotNull)
				{
					return DateTimeStringUtilities.ToString(m_year, m_month, m_day, m_hour, m_minute, m_second, m_nanosecond);
				}
				return "null";
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ToString, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ToString);
				}
			}
		}

		public int CompareTo(object obj)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.CompareTo);
			}
			try
			{
				if (obj == null)
				{
					throw new ArgumentNullException("obj");
				}
				if (obj.GetType() != typeof(OracleTimeStamp))
				{
					throw new ArgumentException("obj");
				}
				return HelperClass.CompareBytes(m_byteRepresentation, ((OracleTimeStamp)obj).m_byteRepresentation);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.CompareTo, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.CompareTo);
				}
			}
		}

		public override bool Equals(object obj)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.Equals);
			}
			try
			{
				if (obj == null || obj.GetType() != typeof(OracleTimeStamp))
				{
					return false;
				}
				return CompareTo(obj) == 0;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.Equals, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.Equals);
				}
			}
		}

		public override int GetHashCode()
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.GetHashCode);
			}
			try
			{
				if (m_bNotNull)
				{
					return m_byteRepresentation.GetHashCode();
				}
				return 0;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.GetHashCode);
				}
			}
		}

		public OracleIntervalDS GetDaysBetween(OracleTimeStamp value1)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.GetDaysBetween);
			}
			try
			{
				if (m_bNotNull && value1.m_bNotNull)
				{
					if (this > value1)
					{
						return TimeStamp.GetDaysBetweenTimeStamp(m_byteRepresentation, value1.m_hour, value1.m_minute, value1.m_second, value1.m_nanosecond, m_year, m_month, m_day, value1.m_year, value1.m_month, value1.m_day, isPositive: true, OracleDbType.TimeStamp);
					}
					if (this < value1)
					{
						return TimeStamp.GetDaysBetweenTimeStamp(value1.InternalByteRepresentation, m_hour, m_minute, m_second, m_nanosecond, value1.m_year, value1.m_month, value1.m_day, m_year, m_month, m_day, isPositive: false, OracleDbType.TimeStamp);
					}
					return new OracleIntervalDS(0, 0, 0, 0, 0);
				}
				return OracleIntervalDS.Null;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.GetDaysBetween, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.GetDaysBetween);
				}
			}
		}

		public OracleIntervalYM GetYearsBetween(OracleTimeStamp value1)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.GetYearsBetween);
			}
			try
			{
				if (m_bNotNull && value1.m_bNotNull)
				{
					int num = 0;
					int num2 = 0;
					if (this < value1)
					{
						int sumDay = value1.Day - m_day;
						num = value1.Month - m_month;
						num2 = value1.Year - m_year;
						return TimeStamp.GetYearsBetweenTimeStamp(sumDay, num, num2, value1.m_year, isPositive: false);
					}
					if (this > value1)
					{
						int sumDay2 = m_day - value1.Day;
						num = m_month - value1.Month;
						num2 = m_year - value1.Year;
						return TimeStamp.GetYearsBetweenTimeStamp(sumDay2, num, num2, m_year, isPositive: true);
					}
					return new OracleIntervalYM(0, 0);
				}
				return OracleIntervalYM.Null;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.GetYearsBetween, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.GetYearsBetween);
				}
			}
		}

		public OracleDate ToOracleDate()
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ToOracleDate);
			}
			try
			{
				if (m_bNotNull)
				{
					return new OracleDate(m_year, m_month, m_day, m_hour, m_minute, m_second);
				}
				return OracleDate.Null;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ToOracleDate, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ToOracleDate);
				}
			}
		}

		public OracleTimeStampLTZ ToOracleTimeStampLTZ()
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ToOracleTimeStampLTZ);
			}
			try
			{
				if (m_bNotNull)
				{
					return new OracleTimeStampLTZ(m_year, m_month, m_day, m_hour, m_minute, m_second, m_nanosecond);
				}
				return OracleTimeStampLTZ.Null;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ToOracleTimeStampLTZ, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ToOracleTimeStampLTZ);
				}
			}
		}

		public OracleTimeStampTZ ToOracleTimeStampTZ()
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ToOracleTimeStampTZ);
			}
			try
			{
				if (m_bNotNull)
				{
					return new OracleTimeStampTZ(m_year, m_month, m_day, m_hour, m_minute, m_second, m_nanosecond, null);
				}
				return OracleTimeStampTZ.Null;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ToOracleTimeStampTZ, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ToOracleTimeStampTZ);
				}
			}
		}

		public static bool Equals(OracleTimeStamp value1, OracleTimeStamp value2)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.Equals);
			}
			try
			{
				return InternalTypes.CompareNull(!value1.m_bNotNull, !value2.m_bNotNull) switch
				{
					CompareNullEnum.BothNull => true, 
					CompareNullEnum.BothNotNull => value1.CompareTo(value2) == 0, 
					_ => false, 
				};
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.Equals, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.Equals);
				}
			}
		}

		public static bool GreaterThan(OracleTimeStamp value1, OracleTimeStamp value2)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.GreaterThan);
			}
			try
			{
				return value1.CompareTo(value2) == 1;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.GreaterThan);
				}
			}
		}

		public static bool GreaterThanOrEqual(OracleTimeStamp value1, OracleTimeStamp value2)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.GreaterThanOrEqual);
			}
			try
			{
				return value1.CompareTo(value2) >= 0;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.GreaterThanOrEqual);
				}
			}
		}

		public static bool LessThan(OracleTimeStamp value1, OracleTimeStamp value2)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.LessThan);
			}
			try
			{
				return value1.CompareTo(value2) == -1;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.LessThan);
				}
			}
		}

		public static bool LessThanOrEqual(OracleTimeStamp value1, OracleTimeStamp value2)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.LessThanOrEqual);
			}
			try
			{
				return value1.CompareTo(value2) <= 0;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.LessThanOrEqual);
				}
			}
		}

		public static bool NotEquals(OracleTimeStamp value1, OracleTimeStamp value2)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.NotEquals);
			}
			try
			{
				return value1.CompareTo(value2) != 0;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.NotEquals);
				}
			}
		}

		public static OracleTimeStamp GetSysDate()
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.GetSysDate);
			}
			try
			{
				return new OracleTimeStamp(DateTime.Now);
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.GetSysDate);
				}
			}
		}

		public static OracleTimeStamp Parse(string tsStr)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.Parse);
			}
			try
			{
				return new OracleTimeStamp(tsStr);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.Parse, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.Parse);
				}
			}
		}

		public static OracleTimeStamp SetPrecision(OracleTimeStamp value1, int fracSecPrecision)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.SetPrecision);
			}
			try
			{
				if (!value1.m_bNotNull)
				{
					throw new OracleNullValueException();
				}
				if (fracSecPrecision < 0 || fracSecPrecision > 9)
				{
					throw new ArgumentOutOfRangeException("fracSecPrecision");
				}
				return new OracleTimeStamp(value1.InternalByteRepresentation, fracSecPrecision);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.SetPrecision, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.SetPrecision);
				}
			}
		}

		public static bool operator ==(OracleTimeStamp value1, OracleTimeStamp value2)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorEqualTo);
			}
			try
			{
				return Equals(value1, value2);
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorEqualTo);
				}
			}
		}

		public static bool operator >(OracleTimeStamp value1, OracleTimeStamp value2)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorGreaterThan);
			}
			try
			{
				return GreaterThan(value1, value2);
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorGreaterThan);
				}
			}
		}

		public static bool operator >=(OracleTimeStamp value1, OracleTimeStamp value2)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorGreaterThanOrEqualTo);
			}
			try
			{
				return GreaterThanOrEqual(value1, value2);
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorGreaterThanOrEqualTo);
				}
			}
		}

		public static bool operator <(OracleTimeStamp value1, OracleTimeStamp value2)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorLessThan);
			}
			try
			{
				return LessThan(value1, value2);
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorLessThan);
				}
			}
		}

		public static bool operator <=(OracleTimeStamp value1, OracleTimeStamp value2)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorLessThanOrEqualTo);
			}
			try
			{
				return LessThanOrEqual(value1, value2);
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorLessThanOrEqualTo);
				}
			}
		}

		public static bool operator !=(OracleTimeStamp value1, OracleTimeStamp value2)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorNotEqualTo);
			}
			try
			{
				return NotEquals(value1, value2);
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorNotEqualTo);
				}
			}
		}

		public static OracleTimeStamp operator +(OracleTimeStamp value1, OracleIntervalDS value2)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorPlus);
			}
			try
			{
				if (value1.IsNull || value2.IsNull)
				{
					return Null;
				}
				return AddDayTimeToTimeStamp(value1.m_byteRepresentation, value2, 11);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorPlus, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorPlus);
				}
			}
		}

		public static OracleTimeStamp operator +(OracleTimeStamp value1, OracleIntervalYM value2)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorPlus);
			}
			try
			{
				if (value1.IsNull || value2.IsNull)
				{
					return Null;
				}
				return AddYearMonthToTimeStamp(value1.InternalByteRepresentation, value2.Years, value2.Months);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorPlus, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorPlus);
				}
			}
		}

		public static OracleTimeStamp operator +(OracleTimeStamp value1, TimeSpan value2)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorPlus);
			}
			try
			{
				if (value1.IsNull)
				{
					return Null;
				}
				return AddDayTimeToTimeStamp(value1.m_byteRepresentation, value2, 10);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorPlus, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorPlus);
				}
			}
		}

		public static OracleTimeStamp operator -(OracleTimeStamp value1, OracleIntervalDS value2)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorMinus);
			}
			try
			{
				if (value1.IsNull || value2.IsNull)
				{
					return Null;
				}
				return AddDayTimeToTimeStamp(value1.m_byteRepresentation, -value2, 11);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorMinus, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorMinus);
				}
			}
		}

		public static OracleTimeStamp operator -(OracleTimeStamp value1, OracleIntervalYM value2)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorMinus);
			}
			try
			{
				if (value1.IsNull || value2.IsNull)
				{
					return Null;
				}
				return AddYearMonthToTimeStamp(value1.InternalByteRepresentation, -value2.Years, -value2.Months);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorMinus, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorMinus);
				}
			}
		}

		public static OracleTimeStamp operator -(OracleTimeStamp value1, TimeSpan value2)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorMinus);
			}
			try
			{
				if (value1.IsNull)
				{
					return Null;
				}
				return AddDayTimeToTimeStamp(value1.m_byteRepresentation, -value2, 10);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorMinus, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.OperatorMinus);
				}
			}
		}

		public static explicit operator OracleTimeStamp(string tsStr)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor);
			}
			try
			{
				return new OracleTimeStamp(tsStr);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor);
				}
			}
		}

		public static explicit operator DateTime(OracleTimeStamp value1)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.DateTime);
			}
			try
			{
				if (value1.m_bNotNull)
				{
					return DateTimeConv.GetDateTime(value1.m_byteRepresentation, OracleDbType.TimeStamp);
				}
				throw new OracleNullValueException();
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.DateTime, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.DateTime);
				}
			}
		}

		public static implicit operator OracleTimeStamp(OracleDate value1)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor);
			}
			try
			{
				if (!value1.IsNull)
				{
					byte[] byteRepresentation = value1.m_byteRepresentation;
					byte[] array = new byte[11];
					Array.Copy(byteRepresentation, array, byteRepresentation.Length);
					return new OracleTimeStamp(array, bCopyData: false);
				}
				return Null;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor);
				}
			}
		}

		public static explicit operator OracleTimeStamp(OracleTimeStampLTZ value1)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor);
			}
			try
			{
				if (!value1.IsNull)
				{
					byte[] internalByteRepresentation = value1.InternalByteRepresentation;
					byte[] array = new byte[11];
					Array.Copy(internalByteRepresentation, array, internalByteRepresentation.Length);
					return new OracleTimeStamp(array, bCopyData: false);
				}
				return Null;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor);
				}
			}
		}

		public static explicit operator OracleTimeStamp(OracleTimeStampTZ value1)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor);
			}
			try
			{
				if (!value1.IsNull)
				{
					return new OracleTimeStamp(value1.Year, value1.Month, value1.Day, value1.Hour, value1.Minute, value1.Second, value1.Nanosecond);
				}
				return Null;
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor);
				}
			}
		}

		public static implicit operator OracleTimeStamp(DateTime value1)
		{
			if (ProviderConfig.m_bTraceLevelPublic)
			{
				Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor);
			}
			try
			{
				return new OracleTimeStamp(value1);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.ctor);
				}
			}
		}

		internal static OracleTimeStamp AddDayTimeToTimeStamp(byte[] byteRepresentation, object value, byte tsComponent)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddDayTimeToTimeStamp);
			}
			try
			{
				return new OracleTimeStamp(TimeStamp.AddDayTimeToTimeStamp(byteRepresentation, value, tsComponent, OracleDbType.TimeStamp), bCopyData: false);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddDayTimeToTimeStamp, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddDayTimeToTimeStamp);
				}
			}
		}

		internal static OracleTimeStamp AddYearMonthToTimeStamp(byte[] byteRepresentation, int yearToBeAdded, long monthToBeAdded)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Entry, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddYearMonthToTimeStamp);
			}
			try
			{
				return new OracleTimeStamp(TimeStamp.AddYearMonthToTimeStamp(byteRepresentation, yearToBeAdded, monthToBeAdded, OracleDbType.TimeStamp), bCopyData: false);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, OracleTraceTag.Error, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddYearMonthToTimeStamp, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, OracleTraceTag.Exit, OracleTraceClassName.OracleTimeStamp, OracleTraceFuncName.AddYearMonthToTimeStamp);
				}
			}
		}

		private void FromString(string tsStr)
		{
			if (tsStr == null)
			{
				throw new ArgumentNullException();
			}
			string region = null;
			DateTimeStringUtilities.FromString(tsStr, out m_year, out m_month, out m_day, out m_hour, out m_minute, out m_second, out m_nanosecond, out region, expectNoRegion: true);
			m_byteRepresentation = TimeStamp.ConstructByteArrayTS(m_year, m_month, m_day, m_hour, m_minute, m_second, m_nanosecond);
		}
	}
}
